package com.vieewer.btdemo.broadcasts;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.vieewer.btdemo.MainActivity;
import com.vieewer.btdemo.view.main.HomeGuideActivity;

public class BootCompletedReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {

        if(intent.getAction() == Intent.ACTION_BOOT_COMPLETED) {
            //在这里定义后续的处理，比如启动Activity和Service
            Log.i("yjj", "自启动程序即将执行");

            Intent mBootIntent = new Intent(context, HomeGuideActivity.class);
            //下面这句话必须加上才能开机自动运行app的界面
            mBootIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(mBootIntent);

        }
    }
}